# Maintainer: team/rust <alpine@ptrcnull.me>
pkgname=cargo-auditable
pkgver=0.6.2
pkgrel=0
pkgdesc="Cargo wrapper for embedding auditing data"
url="https://github.com/rust-secure-code/cargo-auditable"
arch="all"
license="MIT OR Apache-2.0"
depends="cmd:cargo"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/rust-secure-code/cargo-auditable/archive/refs/tags/v$pkgver.tar.gz
	0001-Fix-tests-on-Rust-1.77.patch
	add-loongarch64-support.patch
	upgrade-rust-libc.patch
	"
options="net"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	msg "building cargo auditable"
	cargo build --release --frozen
	msg "rebuilding with cargo-auditable itself"
	PATH="$PATH:$PWD/target/release" \
		cargo auditable build --release --frozen
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/cargo-auditable -t "$pkgdir"/usr/bin/
	install -Dm644 cargo-auditable/cargo-auditable.1 -t "$pkgdir"/usr/share/man/man1/
}

sha512sums="
3656f124d8e43fbb4518d9aa3ad9e40a7cae61c56fa4718e9ff886934b2fcb5b2f116551c63ca17712c203ac93daf2b28a22efe41e556013189dec0ad9248f1f  cargo-auditable-0.6.2.tar.gz
b5a871ea32bbfba1c6cda46c97ed5793f5dafeb237fc7da2462408d7125ac75519cad9ba6af159a4ce8abe6285b19c65048ba37c3e4a3c05f81625482d575235  0001-Fix-tests-on-Rust-1.77.patch
27dc8f73fa981e7d04a37def2355a2f1466162a727e20e2a346c05d33c0e0eb97b7e9e03a6ccadd20a356ad78598c3a93f44bf9c0293cd2b7dc8779e05399fb3  add-loongarch64-support.patch
0721760a8d747e0ee4a34153bcc056503b07e812b2b74475492d6eacb5afc5c86c80e571c6c92ab07bd737969e19149e21c677a5fd65665183bbf62feb549ac5  upgrade-rust-libc.patch
"
